<template>
  <div class="container">
    <div class="chart">
      <WChart :option="option" width="100%" height="100%" />
    </div>
  </div>
</template>
<script>
import WChart from '@comp/chart/index.vue'
export default {
  name: 'LeftItem4',
  components: {
    WChart
  },
  data() {
    return {
      option: {
        grid: {
          top: '40',
          left: '40',
          right: '10',
          bottom: '30'
        },
        legend: {
          selectedMode: true
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          },
          formatter: function (params) {
            var tar = params[1]
            return tar.name + '<br/> ' + tar.seriesName + ' : ' + tar.data
          }
        },
        xAxis: {
          type: 'category',
          data: ['公司领导', '安环部', '生技部', '运行分场', '外委单位']
        },
        yAxis: {
          type: 'value',
          name: '单位：万元'
        },
        series: [
          {
            name: '公司领导',
            type: 'bar',
            label: {
              show: true,
              position: 'top'
            },
            emphasis: {
              focus: 'series'
            },
            data: [320, 302, 301, 334, 390]
          },
          {
            name: '安环部',
            type: 'bar',
            label: {
              show: true,
              position: 'top'
            },
            emphasis: {
              focus: 'series'
            },
            data: [350, 302, 301, 334, 390]
          },
          {
            name: '生技部',
            type: 'bar',
            label: {
              show: true,
              position: 'top'
            },
            emphasis: {
              focus: 'series'
            },
            data: [420, 302, 301, 334, 390]
          }
        ]
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.container {
  display: flex;
  height: 100%;
  justify-content: right;
  .chart {
    width: 100%;
    height: 100%;
  }
  .title {
    width: 50%;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    align-items: center;
    justify-content: center;
    span {
      font-size: 16px;
      padding: 5px 10px;
    }
  }
}
</style>
